/* Tenaro UI foundation — additive application primitives (Phase 1) */
:root {
  --tenaro-canvas: var(--bg, #f3f6fa);
  --tenaro-surface: var(--surface, #fff);
  --tenaro-surface-muted: var(--surface-alt, #f8fafc);
  --tenaro-ink: var(--text, #172033);
  --tenaro-muted: var(--text-muted, #64748b);
  --tenaro-line: var(--border, var(--line, #dce3ec));
  --tenaro-primary: var(--accent, var(--brand, #0f9f91));
  --tenaro-radius-sm: 10px;
  --tenaro-radius: 16px;
  --tenaro-radius-lg: 20px;
  --tenaro-shadow: 0 8px 28px rgba(15, 23, 42, .07);
  --tenaro-focus: 0 0 0 3px rgba(20, 184, 166, .24);
  --tenaro-touch: 44px;
}

body.tenaro-app { background:var(--tenaro-canvas); color:var(--tenaro-ink); -webkit-tap-highlight-color:transparent; }
body.tenaro-app :where(a,button,input,select,textarea,[tabindex]):focus-visible { outline:2px solid var(--tenaro-primary); outline-offset:2px; box-shadow:var(--tenaro-focus); }
body.tenaro-app :where(.btn,.icon-btn,.hamburger,.theme-toggle,.card-action,button,input[type="button"],input[type="submit"],select) { min-height:var(--tenaro-touch); }
body.tenaro-app :where(.icon-btn,.hamburger) { min-width:var(--tenaro-touch); display:inline-flex; align-items:center; justify-content:center; border-radius:var(--tenaro-radius-sm); }
body.tenaro-app :where(.card,.panel,.settings-row,.sso-config-card) { border-color:var(--tenaro-line); border-radius:var(--tenaro-radius); box-shadow:var(--tenaro-shadow); }
body.tenaro-app :where(input,select,textarea) { border-radius:var(--tenaro-radius-sm); }
body.tenaro-app :where(input,select,textarea):disabled,
body.tenaro-app :where(input,select,textarea)[readonly] { opacity:1; color:var(--tenaro-ink); background:var(--tenaro-surface-muted); border-style:dashed; cursor:default; }
body.tenaro-app :where(.page-header,.panel-head,.card-header) { gap:12px; }
body.tenaro-app .topbar-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.tenaro-app .topbar-actions { min-width:0; }
body.tenaro-app .tenaro-responsive-table { display:block; width:100%; max-width:100%; min-width:0!important; overflow-x:auto; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; scrollbar-gutter:stable; }
body.tenaro-app .tenaro-responsive-table :where(thead,tbody) { display:table; width:100%; min-width:620px; table-layout:fixed; }
body.tenaro-app .tenaro-responsive-table tr { display:table-row; }
body.tenaro-app .tenaro-responsive-table :where(th,td) { display:table-cell; }
body.tenaro-app .card-action { display:inline-flex; align-items:center; }
body.tenaro-app :where(.badge,.status,.status-badge) { line-height:1.25; }

/* Generic modal primitive. Existing open/close behavior remains owned by each app. */
body.tenaro-app .modal-backdrop { padding:20px; }
body.tenaro-app .modal { border-radius:var(--tenaro-radius-lg); box-shadow:0 24px 70px rgba(2,6,23,.28); max-height:min(88vh,760px); overflow:auto; }
body.tenaro-app .modal :where(.modal-header,.modal-footer) { background:var(--tenaro-surface); z-index:2; }
body.tenaro-app .modal .modal-header { position:sticky; top:0; }
body.tenaro-app .modal .modal-footer { position:sticky; bottom:0; }

[data-theme="dark"] body.tenaro-app,
body.tenaro-app[data-theme="dark"],
body.tenaro-app.theme-dark { color-scheme:dark; }
body.tenaro-app[data-theme="dark"] :where(.card,.panel,.modal,.settings-row,input,select,textarea),
[...truncated]
body.tenaro-app[data-theme="dark"] :where(input,select,textarea):disabled,
body.tenaro-app[data-theme="dark"] :where(input,select,textarea)[readonly],
body.tenaro-app.theme-dark :where(input,select,textarea):disabled,
body.tenaro-app.theme-dark :where(input,select,textarea)[readonly] { background:var(--tenaro-surface-muted); color:var(--tenaro-ink); -webkit-text-fill-color:var(--tenaro-ink); }

@media (max-width:900px) {
  body.tenaro-app .tenaro-owner-kpis { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width:700px) {
  body.tenaro-app .topbar { gap:8px; }
  body.tenaro-app .topbar-title { font-size:14px; }
  body.tenaro-app .topbar-actions { gap:4px; flex-wrap:nowrap; }
  body.tenaro-app .theme-toggle { width:var(--tenaro-touch); padding:0; justify-content:center; }
  body.tenaro-app .theme-toggle :where(#theme-toggle-label,.theme-toggle-label) { display:none; }
  body.tenaro-app :where(.page-header,.panel-head) { align-items:stretch; flex-direction:column; }
  body.tenaro-app :where(.page-header,.panel-head) > :where(.actions,.page-actions) { width:100%; }
  body.tenaro-app :where(.settings-row,.profile-row) { align-items:stretch; flex-direction:column; gap:12px; }
  body.tenaro-app :where(.settings-row,.profile-row) > :last-child { width:100%; }
  body.tenaro-app .content { padding-bottom:calc(24px + env(safe-area-inset-bottom,0px)); }
  body.tenaro-app .modal-backdrop { align-items:flex-end; padding:0; }
  body.tenaro-app .modal { width:100%; max-width:none; max-height:calc(100dvh - env(safe-area-inset-top,0px)); border-radius:20px 20px 0 0; padding-bottom:env(safe-area-inset-bottom,0px); }
}
@media (max-width:420px) {
  body.tenaro-app .tenaro-owner-kpis { grid-template-columns:1fr !important; }
}
@media (prefers-reduced-motion:reduce) {
  body.tenaro-app *,body.tenaro-app *::before,body.tenaro-app *::after { scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; animation-iteration-count:1!important; }
}

/* Public, authentication and secure-action surfaces. */
body.tenaro-public{--tenaro-navy:#08111d;--tenaro-teal:#18b6a8;margin:0;min-height:100dvh;overflow-x:hidden;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
body.tenaro-public :where(button,.btn,input,select,textarea,summary,a.btn){min-height:44px}
body.tenaro-public :where(input,select,textarea){max-width:100%;box-sizing:border-box;font:inherit}
body.tenaro-public :where(.err,.bad,.alert-error,.field-error){line-height:1.5;overflow-wrap:anywhere}
body.tenaro-public :where(button,.btn,a,input,summary):focus-visible{outline:2px solid var(--tenaro-teal);outline-offset:3px;box-shadow:0 0 0 4px rgba(24,182,168,.18)}
body.tenaro-public .tenaro-brandline{display:flex;align-items:center;gap:12px;margin-bottom:22px;color:inherit;text-decoration:none;font-weight:850;font-size:20px;letter-spacing:-.03em}
body.tenaro-public .tenaro-brandline img{width:42px;height:42px;object-fit:contain;border-radius:12px;background:#0f172a;padding:6px;box-sizing:border-box}
body.tenaro-public .tenaro-kicker{color:#0f8a80;font-size:12px;font-weight:850;letter-spacing:.09em;text-transform:uppercase}
body.tenaro-public.tenaro-auth-page{background:radial-gradient(circle at 15% 10%,rgba(24,182,168,.16),transparent 30%),linear-gradient(180deg,#08111d,#0e1727);color:#e5e7eb;padding-bottom:env(safe-area-inset-bottom,0px)}
body.tenaro-public.tenaro-auth-page> .card{box-sizing:border-box;margin:clamp(18px,6vh,64px) auto;background:#fff;color:#0f172a;border:1px solid rgba(24,182,168,.24);border-radius:24px;box-shadow:0 24px 80px rgba(2,6,23,.48)}
body.tenaro-public.tenaro-lease-page .card{max-width:820px}body.tenaro-public.tenaro-lease-page .notice{margin:18px 0;padding:16px;border-left:4px solid var(--tenaro-teal)}
body.tenaro-public.tenaro-lease-page .agree{min-height:44px;padding:14px;border:1px solid #dce3ec;border-radius:14px;background:#f8fafc;line-height:1.5}body.tenaro-public.tenaro-lease-page .agree input{width:22px;height:22px;flex:0 0 auto}body.tenaro-public.tenaro-lease-page #sign-btn{width:100%;min-height:50px;background:linear-gradient(180deg,#18b6a8,#0f8a80)}
@media(max-width:700px){body.tenaro-public .nav-inner{min-height:56px!important;padding:8px 0!important;flex-wrap:nowrap!important}body.tenaro-public .nav .brand-mark{width:38px;height:38px;border-radius:11px}body.tenaro-public.tenaro-auth-page{padding:0}body.tenaro-public.tenaro-auth-page> .card{width:calc(100% - 24px);margin:12px auto;border-radius:20px;padding:18px}body.tenaro-public.tenaro-onboarding-page .shell{display:flex!important;flex-direction:column}body.tenaro-public.tenaro-onboarding-page .form-card{order:-1}body.tenaro-public.tenaro-onboarding-page .hero{padding:18px 4px!important}body.tenaro-public.tenaro-onboarding-page .steps{display:none!important}body.tenaro-public.tenaro-lease-page> .card{width:100%;margin:0;border-radius:0;min-height:100dvh;padding:20px 16px calc(24px + env(safe-area-inset-bottom,0px))}}

/* Role-specific mobile polish discovered during rendered visual review. */
@media(max-width:700px){
  body.tenaro-owner-app .dashboard-tenant-table{display:block!important;min-width:0!important;padding:8px 12px 14px}
  body.tenaro-owner-app .dashboard-tenant-table thead{display:none}
  body.tenaro-owner-app .dashboard-tenant-table tbody{display:grid;gap:10px}
  body.tenaro-owner-app .dashboard-tenant-table tr{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:7px 12px;padding:13px;border:1px solid var(--tenaro-line);border-radius:14px;background:var(--tenaro-surface)}
  body.tenaro-owner-app .dashboard-tenant-table td{display:block!important;width:auto!important;padding:0!important;border:0!important;min-width:0}
  body.tenaro-owner-app .dashboard-tenant-table td:first-child{grid-column:1/-1}
  body.tenaro-owner-app .dashboard-tenant-table td:nth-child(2)::before{content:'Unit';display:block;font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--tenaro-muted);margin-bottom:3px}
  body.tenaro-owner-app .dashboard-tenant-table td:nth-child(3)::before{content:'Rent';display:block;font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--tenaro-muted);margin-bottom:3px}
  body.tenaro-owner-app .dashboard-tenant-table td:nth-child(4){grid-column:1/-1}
  body.tenaro-owner-app .main{padding-bottom:calc(88px + env(safe-area-inset-bottom,0px))}
  body.tenaro-vendor-app .maint-item{appearance:none;-webkit-appearance:none;width:100%;display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;text-align:left;padding:14px 16px;border:0;border-bottom:1px solid var(--tenaro-line);border-radius:0;background:transparent;color:var(--tenaro-ink);box-shadow:none}
  body.tenaro-vendor-app .maint-item:last-child{border-bottom:0}
  body.tenaro-vendor-app .maint-item:hover,body.tenaro-vendor-app .maint-item:focus-visible{background:var(--tenaro-surface-muted)}
  body.tenaro-vendor-app .maint-title{font-weight:700;line-height:1.35}
}

/* Shared public footer: identical copy and presentation on every public Tenaro screen. */
body.tenaro-public .tenaro-site-footer{width:100%;flex:0 0 auto;padding:26px 18px;color:rgba(255,255,255,.72);background:#08111d;text-align:center;font-size:13px;line-height:1.4;letter-spacing:.01em}
body.tenaro-public .tenaro-site-footer>div{display:flex;align-items:center;justify-content:center;text-align:center}

/* Shared light-default treatment for public/account pages that do not define a page-specific light palette. */
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page{color-scheme:light;background:#f6f9fc!important;color:#172235!important}
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page :where(.card,.panel,.auth-card,.lease-card){background:#fff!important;color:#172235!important;border-color:rgba(15,23,42,.12)!important;box-shadow:0 20px 60px rgba(15,23,42,.10)}
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page :where(h1,h2,h3,strong,label){color:#0f172a}
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page :where(p,.sub,.muted,.hint,.secure){color:#64748b}
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page :where(input,select,textarea){background:#fff;color:#0f172a;border-color:rgba(15,23,42,.16)}
:root[data-theme="light"] body.tenaro-public.tenaro-auth-page .tenaro-site-footer{background:#eef3f8;color:#64748b;border-top-color:rgba(15,23,42,.10)}
