/* Projetos & Lembretes — Mart Minas. Baseado no mockup (public/mockup.css), adaptado aos fluxos reais. */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&display=swap');

:root { color-scheme: light;
  --bg: #f5f6f8; --surface: #fff; --surface2: #f9fafb; --ink: #202c29; --muted: #68746f; --line: #e6eae7;
  --green: #176343; --green-soft: #eaf4ed; --red: #c52e27; --red-soft: #fff0ee; --amber: #936017; --amber-soft: #fff5df;
  --blue: #376bab; --blue-soft: #eef3fc; --shadow: 0 6px 22px #17342504; --primary: #176343; --primary-ink: #fff; }
[data-theme=dark] { color-scheme: dark;
  --bg: #111916; --surface: #19231e; --surface2: #202c25; --ink: #edf3ee; --muted: #a7b6ac; --line: #314037;
  --green: #91d6ac; --green-soft: #233c2c; --red: #ffa49b; --red-soft: #452b29; --amber: #f0ca7a; --amber-soft: #3c3424;
  --blue: #a8c9f7; --blue-soft: #28364a; --shadow: none; --primary: #2a8a5f; --primary-ink: #fff; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 'DM Sans', 'Segoe UI', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; transition: background .15s; }
button:hover { filter: brightness(.97); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
i { display: inline-flex; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
aside { width: 270px; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  padding: 30px 18px 20px; display: flex; flex-direction: column; flex-shrink: 0; transition: width .2s; }
.brand { display: flex; flex-direction: column; align-items: flex-start; padding: 0 16px 26px; text-decoration: none; color: var(--muted); background: none; border: 0; text-align: left; }
.brand img { width: 150px; height: auto; display: block; }
[data-theme=dark] .brand img { background: #f4f6f2; border-radius: 8px; padding: 9px; box-sizing: content-box; }
.brand-caption { font-size: 11px; font-weight: 700; letter-spacing: 1.7px; margin-top: 12px; white-space: nowrap; }
.nav-item { background: none; border: 0; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; margin-bottom: 3px;
  border-radius: 8px; text-align: left; color: var(--muted); font-size: 15px; white-space: nowrap; }
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 700; }
.nav-item:hover { background: var(--surface2); }
.nav-count { margin-left: auto; font-size: 13px; border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-bottom #collapse { margin-top: 18px; }
.profile { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 10px; }
.profile strong { font-size: 14px; display: block; }
.profile small { font-size: 12px; color: var(--muted); display: block; margin-top: 3px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.workspace { flex: 1; min-width: 0; }
main { max-width: 1580px; margin: auto; padding: 35px 36px 20px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-heading .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.7px; color: var(--green); margin-bottom: 8px; }
h1 { font-size: 27px; font-weight: 650; letter-spacing: -1px; line-height: 1.2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 21px; letter-spacing: -.5px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.7; }
footer { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); padding-top: 25px; }
.button.mobile-menu { display: none; }
#scrim { display: none; }

/* ---------- buttons ---------- */
.button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; display: inline-flex; gap: 8px; align-items: center;
  justify-content: center; padding: 9px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; min-height: 40px; }
.button svg { width: 16px; height: 16px; }
.button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.button.danger { color: var(--red); }
.button.text { border: 0; background: transparent; color: var(--green); padding: 4px 6px; min-height: 0; }
.button.text.danger { color: var(--red); }
.button.small { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.button:disabled { opacity: .55; cursor: default; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line); border-radius: 8px; width: 35px; height: 35px; flex-shrink: 0; }

/* ---------- metrics / attention ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 23px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 20px; box-shadow: var(--shadow); text-align: left; color: var(--ink); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 14px; font-weight: 500; gap: 10px; }
.metric-icon { display: flex; padding: 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); }
.metric-icon.red { background: var(--red-soft); color: var(--red); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }
.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-value { font-size: 31px; font-weight: 600; letter-spacing: -1px; margin: 9px 0 7px; }
.metric-caption { font-size: 13px; color: var(--muted); }
.metric-caption.red { color: var(--red); }
.attention { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--amber) 24%, var(--surface)); background: var(--amber-soft);
  border-radius: 8px; padding: 15px 18px; margin-bottom: 25px; color: var(--amber); }
.attention strong { font-size: 14px; }
.attention p { font-size: 13px; margin-top: 4px; }
.attention .button { margin-left: auto; color: var(--amber); }

/* ---------- panels / tables ---------- */
.columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(380px, 1fr); gap: 22px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 22px; }
.panel-header { padding: 20px 22px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-header h2 { font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
.panel-header p { font-size: 13px; color: var(--muted); margin-top: 5px; }
.panel-header .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 0 22px 22px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; font-weight: 600; color: var(--muted); background: var(--surface2); padding: 12px 22px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
td { padding: 15px 22px; border-bottom: 1px solid var(--line); font-size: 14.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface2); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .button { margin-left: 2px; }
td.wrap { white-space: normal; min-width: 180px; }
.project-link { font-weight: 600; background: none; border: 0; padding: 0; text-align: left; font-size: 15px; color: var(--ink); line-height: 1.5; }
.project-link:hover { color: var(--green); text-decoration: underline; }
.sub { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: normal; }
.pill { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; padding: 4px 8px; border-radius: 5px; font-weight: 600; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.pill:before { content: ''; width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.gray { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.owner { display: flex; gap: 7px; align-items: center; }
.mini-avatar { background: var(--blue-soft); color: var(--blue); width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.owners { display: flex; gap: 10px; flex-wrap: wrap; }
.panel-foot { padding: 13px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.empty { padding: 36px 22px; text-align: center; color: var(--muted); line-height: 1.8; white-space: normal; }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 22px 20px; }
.search-box { position: relative; flex: 1; min-width: 190px; }
.search-box i { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.search-box svg { width: 16px; height: 16px; }
.search-box input { width: 100%; padding-left: 36px; }
input, select, textarea { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; font-size: 15px; }
textarea { resize: vertical; min-height: 72px; width: 100%; }

/* ---------- timeline (próximos envios) ---------- */
.timeline { padding: 0 22px; }
.timeline-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .8px; margin: 8px 0 2px; }
.timeline-item { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border: 0; }
.time { color: var(--green); font-size: 14px; font-weight: 600; padding-top: 2px; min-width: 46px; }
.timeline-info { border-left: 2px solid var(--line); padding-left: 13px; min-width: 0; }
.timeline-info .project-link { white-space: normal; }
.timeline-info p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.timeline-info .pill { margin-top: 8px; }
.schedule-note { margin: 5px 22px 18px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.schedule-note svg { width: 13px; height: 13px; }
.delivery { display: flex; gap: 10px; align-items: center; }
.delivery-icon { padding: 7px; background: var(--green-soft); color: var(--green); border-radius: 7px; display: inline-flex; }
.delivery-icon.red { background: var(--red-soft); color: var(--red); }
.delivery-icon svg { width: 15px; height: 15px; }

/* ---------- detalhe do projeto ---------- */
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; padding: 0 22px 20px; }
.detail-meta small { display: block; color: var(--muted); margin-bottom: 5px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.detail-meta strong { font-size: 15px; font-weight: 600; }
.detail-meta .full { grid-column: 1 / -1; }
.preview { margin: 0 22px 16px; white-space: pre-wrap; font-family: inherit; background: var(--surface2); border-left: 4px solid var(--green); border-radius: 8px; padding: 14px 16px; font-size: 14px; line-height: 1.6; }
.desc { padding: 0 22px 20px; white-space: pre-wrap; color: var(--muted); font-size: 14px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.settings-body { padding: 0 22px 22px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); padding: 18px 0; flex-wrap: wrap; }
.setting-row > div:first-child { flex: 1; min-width: 200px; }
.setting-row p { font-size: 13.5px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.setting-row strong { font-size: 15px; }
.segmented { display: flex; border: 1px solid var(--line); padding: 3px; border-radius: 8px; gap: 3px; }
.segmented button { background: none; border: 0; border-radius: 5px; padding: 7px 12px; font-size: 14px; }
.segmented button.selected { background: var(--green-soft); color: var(--green); font-weight: 600; }
.form-notice { display: flex; gap: 10px; background: var(--green-soft); color: var(--green); font-size: 13.5px; padding: 12px 13px; border-radius: 8px; margin-top: 18px; line-height: 1.6; }
.form-notice.amber { background: var(--amber-soft); color: var(--amber); }
.form-notice svg { flex-shrink: 0; }

/* ---------- formulários ---------- */
.field { display: block; font-size: 13.5px; font-weight: 600; margin-top: 16px; }
.field > span { display: block; margin-bottom: 7px; }
.field input, .field select, .field textarea { display: block; width: 100%; }
.field .hint, .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 5px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 15px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin-top: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.people-pick { border: 1px solid var(--line); border-radius: 8px; max-height: 230px; overflow-y: auto; margin-top: 7px; }
.people-pick .pp { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 400; }
.people-pick .pp:last-child { border-bottom: none; }
.people-pick .pp input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.people-pick .pp .nm { flex: 1; }
.people-pick .pp .rc { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.weekdays { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.weekdays label { margin: 0; }
.weekdays input { display: none; }
.weekdays span { display: inline-block; padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 500; }
.weekdays input:checked + span { background: var(--green-soft); color: var(--green); border-color: var(--green); font-weight: 600; }
.err { color: var(--red); font-size: 13.5px; margin-top: 12px; display: none; }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--ink); padding: 26px; width: 560px; max-width: calc(100% - 32px); max-height: 92vh; box-shadow: 0 24px 90px #0003; }
dialog::backdrop { background: #0d231b88; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- toast / utilidades ---------- */
#toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 13px 20px; border-radius: 10px;
  box-shadow: 0 8px 30px #0002; font-size: 14.5px; z-index: 50; display: none; max-width: 90%; }
#toast.err { background: var(--red); color: #fff; }
.skip { position: fixed; top: -100px; background: var(--surface); color: var(--ink); padding: 12px; z-index: 100; }
.skip:focus { top: 10px; }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- menu recolhido ---------- */
.collapsed aside { width: 78px; padding-left: 12px; padding-right: 12px; }
.collapsed .brand { padding: 0 0 22px; align-items: center; width: 100%; }
.collapsed .brand img { width: 50px; }
.collapsed[data-theme=dark] .brand img, [data-theme=dark] .collapsed .brand img { padding: 5px; }
.collapsed .brand-caption, .collapsed .nav-item span, .collapsed .nav-count, .collapsed .profile div { display: none; }
.collapsed .nav-item { justify-content: center; padding: 11px 0; }
.collapsed .profile { justify-content: center; }

/* ---------- responsivo ---------- */
@media (max-width: 1200px) {
  aside { width: 250px; } main { padding: 28px 24px; }
  .columns { grid-template-columns: 1fr; }
  .metric { padding: 16px; } .metric-top { font-size: 13px; }
}
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } .form-grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  aside { position: fixed; left: 0; top: 0; bottom: 0; width: 270px !important; z-index: 30; transform: translateX(-100%); transition: transform .2s; padding-left: 18px; padding-right: 18px; }
  .mobile-open aside { transform: translateX(0); }
  .mobile-open #scrim { display: block; position: fixed; inset: 0; border: 0; background: #0006; z-index: 25; }
  .button.mobile-menu { display: inline-flex; margin-bottom: 22px; }
  main { padding: 22px 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  h1 { font-size: 24px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 14px; } .metric-value { font-size: 28px; }
  .attention { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .attention .button { margin-left: 32px; }
  .panel-header { padding: 18px; } .filters { padding: 0 18px 18px; gap: 8px; } .filters select { flex: 1; }
  th, td { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-meta, .desc, .preview, .timeline, .schedule-note, .settings-body, .panel-body { padding-left: 18px; padding-right: 18px; }
  .preview { margin-left: 18px; margin-right: 18px; }
  footer { flex-direction: column; line-height: 1.8; }
  /* no celular o menu abre sempre expandido */
  .collapsed .brand-caption, .collapsed .nav-item span, .collapsed .nav-count, .collapsed .profile div { display: block; }
  .collapsed .nav-item span { display: inline; }
  .collapsed .nav-item { justify-content: flex-start; padding: 10px 14px; }
  .collapsed .brand { align-items: flex-start; padding: 0 16px 26px; } .collapsed .brand img { width: 150px; }
  .collapsed .profile { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
