:root {
  --ink: #18211f;
  --muted: #6d7773;
  --line: #e3e7e5;
  --soft: #f4f6f5;
  --green: #26785c;
  --green-dark: #1b5e48;
  --green-soft: #eaf4ef;
  --cream: #faf9f6;
  --white: #fff;
  --danger: #a34444;
  --shadow: 0 18px 48px rgba(21, 35, 30, .09);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: "Manrope", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.portal-header {
  min-height: 74px; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 12px clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95);
}
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--green); color: white; font-size: 19px; font-weight: 700;
}
.brand strong, .brand small, .files-link strong, .files-link small { display: block; }
.brand strong { font-size: 16px; }
.brand small, .files-link small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.files-link {
  min-width: 220px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center;
  gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: white;
}
.files-link:hover { border-color: #a8cabc; box-shadow: 0 8px 24px rgba(21,35,30,.07); }
.files-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.arrow { color: var(--green); }
.back-link { color: var(--green-dark); font-size: 12px; font-weight: 700; }

.portal-main, .files-main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.portal-main { padding: clamp(54px, 9vw, 110px) 0; }
.hero { max-width: 660px; }
.eyebrow { margin: 0; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 9px 0 10px; font-size: clamp(34px, 5vw, 58px); line-height: 1.06; letter-spacing: -.05em; }
.hero > p:last-child, .files-heading p { color: var(--muted); line-height: 1.65; }
.modes { margin-top: 42px; }
.mode-card {
  width: min(720px, 100%); display: grid; grid-template-columns: 220px 1fr; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: 0 24px 58px rgba(21,35,30,.13); }
.mode-visual { position: relative; min-height: 250px; overflow: hidden; background: #dfeee7; }
.tree-line { position: absolute; left: 30px; height: 8px; border-radius: 8px; background: rgba(38,120,92,.22); }
.line-one { top: 56px; width: 118px; }
.line-two { top: 91px; left: 54px; width: 130px; }
.line-three { top: 126px; left: 76px; width: 95px; }
.tree-line::before { content: ""; position: absolute; left: -13px; top: -3px; width: 14px; height: 14px; border-radius: 4px; background: var(--green); }
.basket-shape {
  position: absolute; right: 25px; bottom: 24px; width: 82px; height: 62px; display: grid; place-items: center;
  border-radius: 15px 15px 24px 24px; background: var(--green-dark); color: white; font-size: 15px; font-weight: 700;
  transform: rotate(-3deg);
}
.mode-content { padding: 30px; }
.status { display: inline-block; padding: 5px 8px; border-radius: 20px; background: var(--green-soft); color: var(--green-dark); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mode-content h2 { margin: 14px 0 8px; font-size: 24px; letter-spacing: -.04em; }
.mode-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.open-mode { display: inline-flex; gap: 10px; margin-top: 28px; color: var(--green-dark); font-size: 12px; font-weight: 700; }

.files-main { padding: 52px 0 80px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; color: var(--muted); font-size: 11px; }
.breadcrumbs a:hover { color: var(--green-dark); }
.breadcrumbs strong { color: var(--ink); }
.files-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.files-heading h1 { font-size: 42px; }
.files-heading p { max-width: 640px; margin-bottom: 0; }
.file-count { flex: 0 0 auto; padding: 7px 10px; border-radius: 20px; background: var(--soft); color: var(--muted); font-size: 11px; }
.notice { margin-top: 20px; padding: 12px 14px; border-radius: 10px; font-size: 12px; }
.notice.success { background: var(--green-soft); color: var(--green-dark); }
.notice.error { background: #f8e9e9; color: var(--danger); }
.file-tools { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(440px, 1.28fr); gap: 14px; margin-top: 28px; }
.folder-card, .upload-card {
  display: grid; gap: 12px; padding: 14px;
  border: 1px solid var(--line); border-radius: 16px; background: white;
}
.folder-card { grid-template-columns: auto 1fr auto; align-items: center; }
.folder-card label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.folder-card input[type="text"] { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 6px 0; outline: none; color: var(--ink); }
.folder-card input[type="text"]:focus { border-color: var(--green); }
.folder-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); color: var(--green-dark); font-size: 19px; }
.secondary-button { align-self: stretch; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: white; color: var(--green-dark); font-size: 11px; font-weight: 700; cursor: pointer; }
.upload-card { grid-template-columns: 1fr auto; }
.upload-zone { min-height: 76px; display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 1px dashed #afc1ba; border-radius: 12px; cursor: pointer; background: #fbfcfb; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 2px rgba(38,120,92,.08); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone strong, .upload-zone small { display: block; }
.upload-zone small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.upload-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.primary-button { align-self: stretch; min-width: 130px; border: 0; border-radius: 11px; padding: 0 18px; background: var(--green); color: white; font-weight: 700; cursor: pointer; }
.primary-button:disabled { opacity: .55; cursor: default; }
.file-list { margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.file-row { display: grid; grid-template-columns: minmax(260px, 1fr) 110px 150px 230px; gap: 16px; align-items: center; min-height: 64px; padding: 10px 18px; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-row-head { min-height: 42px; background: var(--soft); color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.file-name { min-width: 0; display: flex; align-items: center; gap: 10px; }
.file-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.document-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--soft); color: var(--green-dark); }
.folder-icon { background: #f2ead8; color: #916d2e; }
.folder-row { background: #fffefa; }
.file-meta { color: var(--muted); font-size: 10px; }
.file-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.file-actions form { margin: 0; }
.file-actions a, .file-actions button { border: 0; background: none; padding: 4px; color: var(--green-dark); font-size: 10px; font-weight: 700; cursor: pointer; }
.file-actions button { color: var(--danger); }
.files-empty { min-height: 240px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.files-empty > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--soft); color: var(--green); font-size: 20px; }
.files-empty strong { margin-top: 10px; color: var(--ink); }
.files-empty p { margin: 4px 0 0; font-size: 11px; }

.preview-body { min-height: 100vh; background: #eef1ef; }
.preview-actions { display: flex; align-items: center; gap: 18px; }
.preview-download { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: 9px; background: var(--green); color: white; font-size: 11px; font-weight: 700; }
.preview-main { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 50px; }
.preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.preview-heading h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; }
.preview-heading span { color: var(--muted); font-size: 10px; }
.preview-canvas { min-height: calc(100vh - 180px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.image-preview { display: grid; place-items: center; padding: 24px; }
.image-preview img { display: block; max-width: 100%; max-height: calc(100vh - 230px); object-fit: contain; }
.pdf-preview iframe { display: block; width: 100%; height: calc(100vh - 180px); border: 0; }
.text-preview { min-height: calc(100vh - 180px); margin: 0; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: white; color: #26332f; font: 12px/1.65 Consolas, "Courier New", monospace; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow); }
.preview-unsupported { min-height: 420px; display: grid; place-items: center; align-content: center; text-align: center; border: 1px solid var(--line); border-radius: 14px; background: white; }
.preview-unsupported > span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; background: var(--soft); color: var(--green); font-size: 22px; }
.preview-unsupported strong { margin-top: 14px; }
.preview-unsupported p { margin: 6px 0 18px; color: var(--muted); font-size: 11px; }

@media (max-width: 760px) {
  .portal-header { align-items: stretch; }
  .files-link { min-width: 0; }
  .mode-card { grid-template-columns: 1fr; }
  .mode-visual { min-height: 180px; }
  .files-heading { align-items: flex-start; }
  .file-tools { grid-template-columns: 1fr; }
  .folder-card, .upload-card { grid-template-columns: 1fr; }
  .folder-symbol { display: none; }
  .secondary-button { min-height: 44px; }
  .primary-button { min-height: 48px; }
  .file-list { overflow-x: auto; }
  .file-row { min-width: 760px; }
}
