/* ===========================================================
   MeuApp — design system
   =========================================================== */
:root{
    --bg:        #0c1015;
    --bg-2:     #10161e;
    --surface:  #161d27;
    --surface-2:#1d2632;
    --border:   #2a3445;
    --border-soft:#222b39;
    --text:     #e6e9ef;
    --muted:    #8b95a8;
    --accent:   #d4a74a;
    --accent-h: #e6bc5e;
    --accent-soft:#3d2f15;
    --ok:       #4ec57a;
    --err:      #ef6b6b;
    --info:     #6db0f0;

    --radius:   12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow:   0 6px 18px rgba(0,0,0,.35);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif:'Source Serif 4', 'Source Serif Pro', Georgia, serif;

    --sidebar-w: 240px;
    --content-max: 980px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
/* atributo hidden tem que vencer display:flex/grid das classes */
[hidden]{ display: none !important; }
body{
    background: radial-gradient(1200px 600px at 20% -10%, #1a2230 0%, transparent 60%) , var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a{ color: inherit; text-decoration:none; }
a:hover{ color: var(--accent-h); }
img{ max-width:100%; }

/* layout shell */
body:not(.no-chrome){
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar{
    background: var(--bg-2);
    border-right: 1px solid var(--border-soft);
    padding: 22px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand{
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 18px;
    border-bottom: 1px solid var(--border-soft);
}
.brand-mark{
    color: var(--accent);
    font-size: 20px; line-height: 1;
}
.brand-mark.big{ font-size: 36px; }
.brand-name{
    font-weight: 600; letter-spacing: .3px;
    font-size: 16px;
}

.nav{
    display: flex; flex-direction: column; gap: 2px;
    flex: 1;
    overflow-y: auto;
}
.nav-section{
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 14px 10px 6px;
}
.nav-item{
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    transition: background .12s, color .12s;
}
.nav-item:hover{ background: var(--surface); color: var(--text); }
.nav-item.is-active{
    background: var(--surface-2);
    color: var(--accent);
    box-shadow: inset 2px 0 0 var(--accent);
}
.nav-ico{ width: 18px; text-align:center; opacity:.85; font-size: 14px; }
.nav-foot{
    padding: 10px 4px 4px;
    border-top: 1px solid var(--border-soft);
    margin-top: 6px;
}
.logout-btn{
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
    letter-spacing: .2px;
}
.logout-btn:hover{
    background: rgba(239, 107, 107, .07);
    border-color: rgba(239, 107, 107, .35);
    color: var(--err);
}
.logout-btn:active{ transform: translateY(1px); }
.logout-ico{ flex-shrink: 0; opacity: .9; }
.logout-btn:hover .logout-ico{ opacity: 1; }

/* main */
.main{
    padding: 26px 32px 60px;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
}

/* page head */
.page-head{
    display:flex; align-items:flex-end; justify-content:space-between; gap: 16px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 18px;
}
.page-head h1{
    margin: 0 0 4px; font-size: 24px; font-weight: 600; letter-spacing: -.01em;
}
.page-head .muted{ margin: 0; }
.head-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* utility */
.muted{ color: var(--muted); }
.small{ font-size: 12.5px; }
em{ font-style: normal; color: var(--accent); }

/* cards */
.card{
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.cards{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.module-card{
    display: flex; gap: 16px; align-items: flex-start;
    background: linear-gradient(180deg, #182030 0%, var(--surface) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px;
    transition: transform .12s, border-color .12s;
}
.module-card:hover{
    border-color: var(--accent);
    transform: translateY(-1px);
}
.module-card.is-soon{ opacity: .55; cursor: default; }
.module-card.is-soon:hover{ transform: none; border-color: var(--border-soft); }
.module-card h2{ margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.module-card p{ margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.module-ico{
    width: 44px; height: 44px;
    display: grid; place-items:center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 18px; flex: 0 0 44px;
}
.cta{ color: var(--accent); font-size: 13px; font-weight: 500; }

/* panel + list */
.panel{
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px 4px 6px;
}
.panel-head{
    display:flex; justify-content: space-between; align-items: center;
    padding: 0 18px 12px;
    border-bottom: 1px solid var(--border-soft);
}
.panel-head h3{ margin: 0; font-size: 15px; font-weight: 600; }
.list{ list-style: none; padding: 0; margin: 0; }
.list-row{
    display:flex; justify-content:space-between; align-items: center; gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-soft);
    transition: background .1s;
}
.list-row:hover{ background: var(--surface-2); }
.list li:last-child .list-row{ border-bottom: none; }
.list-title{ font-weight: 500; }

.empty{
    display:flex; align-items:center; justify-content: center; flex-direction: column;
    gap: 12px; padding: 40px;
    color: var(--muted); text-align: center;
}

/* grid de cards de itens */
.grid-cards{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.item-card{
    display: flex; flex-direction: column; gap: 10px;
    transition: border-color .12s, transform .12s;
}
.item-card:hover{ border-color: var(--accent); transform: translateY(-1px); }
.item-card h3{ margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.item-tags{ display:flex; gap:6px; flex-wrap:wrap; }
.tag{
    display:inline-block; font-size: 11px;
    padding: 2px 8px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    text-transform: uppercase; letter-spacing: .4px;
}
.tag-soft{ background: var(--surface-2); color: var(--muted); }
.item-foot{
    margin-top: auto; display:flex; justify-content: space-between; align-items: center;
    padding-top: 10px; border-top: 1px solid var(--border-soft);
}
.ref{ font-size: 12.5px; color: var(--text); }

/* botões */
.btn{
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--text);
    font: inherit; cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
}
.btn:hover{ background: #25303f; }
.btn-primary{
    background: var(--accent); color: #1a1408;
    font-weight: 600;
}
.btn-primary:hover{ background: var(--accent-h); color: #1a1408; }
.btn-ghost{ background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover{ background: var(--surface-2); }
.btn-block{ width: 100%; }
.btn-danger-ghost{
    background: transparent; border: 1px solid #5a2a2a; color: var(--err);
}
.btn-danger-ghost:hover{ background: #2a1313; }
.btn-link{
    background: transparent; border: 0; color: var(--muted);
    font: inherit; cursor: pointer; text-decoration: underline;
}

/* alerts */
.alert{
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-err{ background: #2a1313; color: var(--err); border-color: #5a2a2a; }
.alert-ok{  background: #15281c; color: var(--ok);  border-color: #1f4d34; }

/* form */
.form-card{
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.grid-2{
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.span-2{ grid-column: 1 / -1; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field span{ font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea{
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
    transition: border-color .12s, background .12s;
}
.field input:focus, .field select:focus, .field textarea:focus{
    outline: none; border-color: var(--accent); background: var(--bg);
}
.field textarea{ resize: vertical; min-height: 80px; font-family: var(--font-sans); }
.row-input{ display:flex; gap:6px; }
.row-input input{ flex:1; }
.form-actions{ display:flex; gap: 12px; align-items: center; margin-top: 18px; }

/* sugestões de tema */
#sugestoes-box{
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: -4px;
}
.sugestoes-head{
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom: 8px;
}
.sugestoes-list{ display:grid; gap: 8px; }
.sugestao{
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color .1s;
}
.sugestao:hover{ border-color: var(--accent); }
.sugestao strong{ display:block; margin-bottom: 2px; }
.sugestao .ref{ display:block; color: var(--accent); font-size: 12px; margin-top: 4px; }
.sugestao p{ margin: 0; color: var(--muted); font-size: 13px; }

/* loading */
.loading{
    position: fixed; inset: 0;
    background: rgba(8,11,16,.78);
    backdrop-filter: blur(4px);
    display: grid; place-items: center;
    z-index: 1000;
}
.loading-card{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 36px; text-align: center;
    box-shadow: var(--shadow);
    max-width: 360px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.loading-card .btn{ margin-top: 14px; }
.spinner{
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* esboço (prose) */
.esboco{
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 36px 42px;
    box-shadow: var(--shadow-sm);
}
.prose{
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.75;
    color: #eef0f4;
}
.prose h1{ font-size: 28px; margin: 0 0 .5em; color: var(--accent); border-bottom: 1px solid var(--border-soft); padding-bottom: .35em; }
.prose h2{ font-size: 21px; margin: 1.6em 0 .4em; color: var(--accent-h); }
.prose h3{ font-size: 17.5px; margin: 1.3em 0 .35em; color: var(--text); }
.prose p{ margin: .6em 0; }
.prose strong{ color: #fff; }
.prose ul, .prose ol{ padding-left: 1.4em; margin: .5em 0; }
.prose li{ margin: .25em 0; }
.prose blockquote{ border-left: 3px solid var(--accent); padding-left: 14px; color: var(--muted); margin: 1em 0; font-style: italic; }
.prose hr{ border: 0; border-top: 1px solid var(--border-soft); margin: 1.5em 0; }
.prose code{ background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* meta */
.meta-block{
    margin-top: 18px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 14px 18px;
}
.meta-block summary{ cursor: pointer; color: var(--muted); }
.meta-grid{
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px;
    margin-top: 12px;
    font-size: 13.5px;
}
.meta-grid .span-full{ grid-column: 1 / -1; }
.meta-pre{
    background: var(--bg-2); padding: 10px; border-radius: var(--radius-sm);
    white-space: pre-wrap; font-size: 12.5px; max-height: 220px; overflow: auto;
    color: var(--muted); margin-top: 4px;
}

.danger-form{ margin-top: 26px; text-align: right; }

/* login */
body.no-chrome{ display:grid; place-items: center; padding: 24px; }
.login-wrap{ width: 100%; max-width: 380px; }
.login-card{ display:flex; flex-direction:column; gap: 14px; padding: 32px; }
.login-brand{ text-align: center; margin-bottom: 6px; }
.login-brand h1{ margin: 4px 0 2px; font-size: 22px; }
.login-brand .muted{ margin: 0; font-size: 13px; }

/* modal custom */
.modal-back{
    position: fixed; inset: 0;
    background: rgba(8,11,16,.7);
    backdrop-filter: blur(3px);
    z-index: 1100;
    display: grid; place-items: center;
}
.modal-card{
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow); max-width: 380px; width: 92%;
}
.modal-card h3{ margin: 0 0 8px; }
.modal-card p{ margin: 0 0 16px; color: var(--muted); }
.modal-foot{ display:flex; gap:8px; justify-content: flex-end; }

/* responsive */
@media (max-width: 760px){
    body:not(.no-chrome){ grid-template-columns: 1fr; }
    .sidebar{
        position: relative; height: auto;
        padding: 12px;
        flex-direction: row; gap: 6px;
        border-right: 0; border-bottom: 1px solid var(--border-soft);
        overflow-x: auto;
    }
    .brand{ border-bottom: 0; padding: 0 8px 0 4px; flex-shrink: 0; }
    .brand-name{ display: none; }
    .nav{ flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; }
    .nav-section{ display: none; }
    .nav-item{ padding: 6px 10px; white-space: nowrap; font-size: 13px; }
    .nav-foot{ padding: 0; flex-shrink: 0; border-top: 0; margin-top: 0; }
    .logout-btn{ padding: 6px 12px; font-size: 12.5px; }
    .logout-btn span:not(.logout-ico){ display: none; }
    .main{ padding: 18px; }
    .grid-2{ grid-template-columns: 1fr; }
    .esboco{ padding: 22px 18px; }
    .page-head{ flex-direction: column; align-items: stretch; }
}

/* impressão */
@media print{
    body{ background: #fff; color: #111; }
    .sidebar, .page-head .head-actions, .meta-block, .danger-form{ display: none !important; }
    .main{ max-width: none; padding: 0; }
    .esboco{ box-shadow: none; border: 0; padding: 0; background: #fff; color: #111; }
    .prose h1, .prose h2{ color: #1a1408; }
}
