/* ============================================================
   takdear office — app.css
   Palette: ink + warm paper, tiga aksen per tipe dokumen
   ============================================================ */
:root {
  --ink:        #1b1b2f;
  --ink-soft:   #4a4a63;
  --paper:      #fbfaf7;
  --surface:    #ffffff;
  --line:       #e7e3d9;
  --line-soft:  #f0ede4;

  --doc:        #2d5bff;   /* Document  */
  --sheet:      #12a06a;   /* Sheet     */
  --slide:      #e8730a;   /* Slide     */
  --doc-bg:     #eef2ff;
  --sheet-bg:   #e7f6ef;
  --slide-bg:   #fdf0e3;

  --danger:     #d23b3b;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 2px rgba(27,27,47,.06), 0 8px 24px rgba(27,27,47,.06);
  --font-ui:    'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--doc); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Brand ---- */
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  font-size: 1.25rem;
}
.brand b { font-weight: 600; }
.brand .dot { color: var(--slide); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: .6rem 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: .15s; text-decoration: none;
}
.btn:hover { border-color: var(--ink-soft); text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #fdeaea; border-color: #f5cccc; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.5rem; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.topbar .right { display: flex; align-items: center; gap: 1rem; }
.who { color: var(--ink-soft); font-size: .88rem; }

/* ---- Layout ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ---- Auth pages ---- */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--doc-bg), transparent),
    radial-gradient(900px 500px at -10% 110%, var(--slide-bg), transparent),
    var(--paper);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h1 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .3rem; font-size: 1.6rem; letter-spacing: -.02em; }
.auth-card .sub { color: var(--ink-soft); margin: 0 0 1.6rem; font-size: .92rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .35rem; color: var(--ink-soft); }
.field input {
  width: 100%; font: inherit; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.field input:focus { outline: 2px solid var(--doc); outline-offset: 0; border-color: var(--doc); }
.auth-card .btn { width: 100%; justify-content: center; margin-top: .4rem; }
.auth-foot { text-align: center; margin-top: 1.2rem; font-size: .88rem; color: var(--ink-soft); }
.alert { background: #fdeaea; color: var(--danger); border: 1px solid #f5cccc; padding: .65rem .8rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1rem; }

/* ---- Dashboard ---- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.dash-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 2rem; letter-spacing: -.02em; margin: 0; }
.dash-head p { margin: .25rem 0 0; color: var(--ink-soft); }

.create-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2.5rem; }
.create-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 1.25rem; cursor: pointer; transition: .15s; text-align: left;
  font: inherit; color: var(--ink); display: flex; gap: .9rem; align-items: center;
}
.create-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.create-card .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.create-card .ic svg { width: 22px; height: 22px; }
.create-card .t { font-weight: 600; }
.create-card .d { font-size: .82rem; color: var(--ink-soft); }
.ic-doc   { background: var(--doc-bg);   color: var(--doc);   }
.ic-sheet { background: var(--sheet-bg); color: var(--sheet); }
.ic-slide { background: var(--slide-bg); color: var(--slide); }

.section-label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 1rem; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.doc-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: .15s; position: relative; }
.doc-card:hover { box-shadow: var(--shadow); }
.doc-card .preview { height: 96px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; padding-left: 1rem; }
.doc-card .bar { width: 4px; height: 56px; border-radius: 4px; }
.bar-doc { background: var(--doc); } .bar-sheet { background: var(--sheet); } .bar-slide { background: var(--slide); }
.doc-card .meta { padding: .85rem 1rem 1rem; }
.doc-card .meta a { color: var(--ink); font-weight: 600; display: block; }
.doc-card .meta .when { font-size: .78rem; color: var(--ink-soft); margin-top: .25rem; }
.pill { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 5px; }
.pill-doc { background: var(--doc-bg); color: var(--doc); } .pill-sheet { background: var(--sheet-bg); color: var(--sheet); } .pill-slide { background: var(--slide-bg); color: var(--slide); }
.doc-card .row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.card-del { position: absolute; top: .6rem; right: .6rem; opacity: 0; transition: .15s; }
.doc-card:hover .card-del { opacity: 1; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---- Editor ---- */
.editor-bar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.editor-bar .title-input { font: inherit; font-weight: 600; font-size: 1.05rem; border: 1px solid transparent; background: transparent; padding: .35rem .5rem; border-radius: 6px; min-width: 200px; flex: 1; max-width: 460px; }
.editor-bar .title-input:hover { border-color: var(--line); }
.editor-bar .title-input:focus { outline: none; border-color: var(--doc); background: #fff; }
.save-state { font-size: .82rem; color: var(--ink-soft); min-width: 92px; }
.save-state.dirty { color: var(--slide); }
.save-state.saved { color: var(--sheet); }
.editor-stage { padding: 1.5rem; }

/* Quill paper look */
.doc-paper { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#editor-doc { min-height: 70vh; font-size: 1rem; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--line) !important; }
.ql-toolbar.ql-snow { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }

/* Sheet */
#editor-sheet { max-width: 100%; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }

/* Slides */
.slide-shell { display: grid; grid-template-columns: 200px 1fr; gap: 1.25rem; max-width: 1100px; margin: 0 auto; }
.slide-rail { display: flex; flex-direction: column; gap: .6rem; max-height: 78vh; overflow: auto; padding-right: .25rem; }
.thumb { border: 2px solid var(--line); border-radius: 8px; background: #fff; aspect-ratio: 16/9; padding: .5rem; cursor: pointer; font-size: .6rem; overflow: hidden; position: relative; }
.thumb.active { border-color: var(--slide); }
.thumb .n { position: absolute; top: 3px; left: 5px; font-weight: 700; color: var(--ink-soft); font-size: .6rem; }
.thumb .th-t { font-weight: 700; margin-top: .8rem; }
.slide-canvas { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 16/9; padding: 3rem 3.5rem; display: flex; flex-direction: column; }
.slide-canvas .s-title { font-family: var(--font-display); font-size: 2rem; font-weight: 600; border: none; outline: none; width: 100%; background: transparent; }
.slide-canvas .s-body { margin-top: 1rem; font-size: 1.15rem; border: none; outline: none; width: 100%; flex: 1; resize: none; background: transparent; font-family: var(--font-ui); line-height: 1.6; }
.slide-tools { display: flex; gap: .5rem; margin-top: 1rem; justify-content: center; }

@media (max-width: 720px) {
  .create-row { grid-template-columns: 1fr; }
  .slide-shell { grid-template-columns: 1fr; }
  .slide-rail { flex-direction: row; max-height: none; }
  .thumb { flex: 0 0 120px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============================================================
   v2 — manajemen, share, kolaborasi, impor
   ============================================================ */

/* Toolbar manajemen dashboard */
.manage-bar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.manage-bar .search { flex: 1; min-width: 200px; font: inherit; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.manage-bar .search:focus { outline: 2px solid var(--doc); border-color: var(--doc); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { font: inherit; font-size: .82rem; font-weight: 600; padding: .45rem .8rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; cursor: pointer; color: var(--ink-soft); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sort { font: inherit; font-size: .85rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }

/* Kartu: bintang, badge, aksi */
.star { position: absolute; top: .55rem; left: .55rem; z-index: 2; border: none; background: rgba(255,255,255,.85); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; color: #cfcabc; font-size: .95rem; line-height: 1; }
.star.on { color: var(--slide); }
.shared-badge { font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--doc); background: var(--doc-bg); padding: .12rem .4rem; border-radius: 5px; }
.card-actions { display: flex; gap: .4rem; margin-top: .7rem; opacity: 0; transition: .15s; }
.doc-card:hover .card-actions { opacity: 1; }

/* Banner kolaborasi */
.collab-banner { background: var(--slide-bg); color: #8a4708; border-bottom: 1px solid #f0d3b0; padding: .6rem 1.25rem; display: flex; align-items: center; gap: .8rem; font-size: .9rem; }

/* Badge hanya-lihat */
.ro-badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); background: var(--line-soft); padding: .25rem .6rem; border-radius: 6px; }

/* Tools sheet (impor/ekspor) */
.sheet-tools { max-width: 100%; display: flex; gap: .5rem; margin-bottom: .75rem; }

/* Modal share */
.modal { position: fixed; inset: 0; background: rgba(27,27,47,.45); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal-card { width: 100%; max-width: 440px; background: #fff; border-radius: var(--radius); padding: 1.75rem; box-shadow: 0 20px 60px rgba(27,27,47,.25); }
.modal-card h2 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .25rem; font-size: 1.35rem; }
.modal-card .sub { color: var(--ink-soft); font-size: .9rem; margin: 0 0 1.25rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn { font: inherit; font-size: .85rem; font-weight: 600; padding: .5rem .9rem; border: none; background: #fff; cursor: pointer; color: var(--ink-soft); }
.seg-btn.active { background: var(--ink); color: #fff; }
.hint { display: block; color: var(--ink-soft); font-size: .78rem; margin-top: .35rem; }
.link-row { display: flex; gap: .5rem; }
.link-row input { flex: 1; font: inherit; font-size: .82rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--line-soft); }
.modal-actions { display: flex; align-items: center; gap: .5rem; margin-top: 1.5rem; }

.editor-bar .ro-badge { margin-left: auto; }
